package com.shadow.manager.dataManager
{
	import com.shadow.dataentities.systemdata.ItemEntity;
	
	import flash.utils.Dictionary;

	/**
	 *物品管理器 
	 * @author Administrator
	 * 
	 */	
	public class ItemsManager
	{
		private static var _instance:ItemsManager;
		private var _itemDic:Dictionary;
		public function ItemsManager(value:Singleton)
		{
			_itemDic = new Dictionary();
		}
		
		public static function getInstance():ItemsManager
		{
			if(ItemsManager._instance == null)
			{
				ItemsManager._instance = new ItemsManager(new Singleton);
			}
			
			return ItemsManager._instance;
		}
		/**
		 *设置物品数据 
		 * @param items
		 * 
		 */		
		public function setData(items:Object):void
		{
			var item:Object;
			var itemEntity:ItemEntity;
			for each(item in items){
				itemEntity = new ItemEntity(item);
				_itemDic[item.id.toString()] = itemEntity;
			}
		}
		
		/**
		 *根据物品ID获取实体 
		 * @param id
		 * @return 
		 * 
		 */		
		public function getItemEntityById(id:String):ItemEntity
		{
			return 	_itemDic[id] as ItemEntity;
		}
		
		
	}
}
class Singleton 
{
	
	
}